package com.dc.designPattern._21_strategy.extend.extend3;

/**
 * Description: 引入策略模式_客户端
 * @author: gdc
 * @date: 2021/6/29
 * @version 1.0
 */
public class Client {

    public static void main(String[] args){
        int a = 20;
        int b = 10;

        Context context1 = new Context(new Add());
        int result = context1.exec(a, b);
        System.out.println("输入的参数：" + a + " | " + b);
        System.out.println("运行的结果：" + a + "+" + b + "=" + result);

        System.out.println("\n-------------------------\n");

        Context context2 = new Context(new Sub());
        int result2 = context2.exec(a, b);
        System.out.println("输入的参数：" + a + " | " + b);
        System.out.println("运行的结果：" + a + "-" + b + "=" + result2);
    }
}
